<template>
    <div class="chat-window">
        <iframe class="iframe" :src="get_url"></iframe>
    </div>
</template>

<script setup>
import chatIcon from '@/components/chatIcon.vue'
import {defineProps, onMounted, ref} from "vue";
import {getUserDetails} from "@/api";
const inputText = ref('')
let Invitation = ref('')
let Invitation_id = ref(0)
let get_url = ref('')

let props = defineProps({
    addressee_id: String | Number,
    key: String | Number,
})

const messages = ref([
    {id: 1, text: '你好', isMe: false},
    {id: 2, text: 'Hi', isMe: true},
])
const comment = ref('')

const getIcon = (e) => {
    comment.value += e
}

const obtain_user = () => {
    getUserDetails().then(res => {
        Invitation.value = res.data.invitation_code_key
        Invitation_id.value = res.data.id
        get_url.value = 'https://im.fupanai.com/chat?user_id='+Invitation_id.value+'&invitation_code_key='+Invitation.value+'&addressee_id='+props.addressee_id;
    });
}

onMounted(() => {
    obtain_user()
})
</script>
<style>
.el-dialog__body{
    padding: 0 !important;
}
.input_box{
    height: 100px !important;
}
.chat_window{
    height: 350px !important;
}
.chat-window{
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}
.iframe{
    width: 450px;
    height: 600px;
}
</style>

<style lang="scss" scoped>

.chat-window {
    max-width: 400px;
    margin: 0 auto;
}

.message-container {
    margin-bottom: 10px;
}

.message {
    padding: 5px;
    margin-bottom: 5px;
}

.message-text {
    padding: 10px;
    border-radius: 5px;
}

.mine {
    background-color: lightblue;
}

.chatIcon_list_item_pj_item_pl {
    width: 100%;
    position: relative;
    bottom: -180px;
    .item_pl_content {
        width: 100%;
        textarea {
            width: 95%;
            border-radius: 30px;
            height: 15px;
            margin-top: 20px;
            padding: 10px 10px;
            resize: none;
            background: #ebf4fd;
            color: #709cd2;
        }
        textarea:focus {
            outline: none;
        }
    }
    .item_pl_caozuo {
        display: flex;
        position: absolute;
        bottom: 15%;
        right: 3%;
        .item_pl_caozuo_img {
            width: 21px;
            height: 21px;
        }
        .item_pl_caozuo_btn {
            width: 42px;
            height: 20px;
            line-height: 20px;
            text-align: center;
            background: linear-gradient(0deg, #085EAF, #2791F4);
            border-radius: 10px;
            font-size: 9px;
            font-family: Source Han Sans CN;
            font-weight: 500;
            cursor: pointer;
            color: #fff;
        }
    }
}
</style>
